wayland: Handle the keymap being needed before we know about seats
authorRob Bradford <rob@linux.intel.com>
Tue, 22 Jan 2013 19:08:56 +0000 (19:08 +0000)
committerRob Bradford <rob@linux.intel.com>
Tue, 22 Jan 2013 19:12:29 +0000 (19:12 +0000)
In the Wayland backend implementation for gdk_display_get_keymap we enumerate
the known devices and look for an core keyboard device. These device objects
are created when we receive the capabilities for the seat. The seat
capabilities may be received after a request for the keymap so we handle this
by creating a temporary keymap which we then free later when we have the real
one.

gdk/wayland/gdkdisplay-wayland.c

index de3352566abf2daff474a4d6122e3817cf215c84..45e5d5af381394009dac80356d524fc3f8d8c96a 100644 (file)
@@ -475,6 +475,7 @@ _gdk_wayland_display_get_keymap (GdkDisplay *display)
   GdkDeviceManager *device_manager;
   GList *list, *l;
   GdkDevice *core_keyboard = NULL;
+  static GdkKeymap *tmp_keymap = NULL;
 
   device_manager = gdk_display_get_device_manager (display);
   list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
@@ -491,7 +492,18 @@ _gdk_wayland_display_get_keymap (GdkDisplay *display)
       break;
     }
 
-  return core_keyboard?_gdk_wayland_device_get_keymap (core_keyboard):NULL;
+  if (core_keyboard && tmp_keymap)
+    {
+      g_object_unref (tmp_keymap);
+      tmp_keymap = NULL;
+    }
+
+  if (core_keyboard)
+    return _gdk_wayland_device_get_keymap (core_keyboard);
+
+  tmp_keymap = _gdk_wayland_keymap_new ();
+
+  return tmp_keymap;
 }
 
 static void